<?php

class PageEditRecord extends Page
{
	public function __construct()
	{
		parent::__construct();
		$this->showMenu = false;
	}
	
	public function getHTML()
	{
		$html = $this->getHeaderHTML();

		$submitScript = new SubmitFormScript();
		$html .= $submitScript->getHTML();

		$updateRecordScript = new UpdateRecordScript();
		$html .= $updateRecordScript->getHTML();

		$html .= $this->getBodyTopHTML();
		$html .= $this->getHiddenVariables();

		$RecordID = new Hidden();
		$RecordID->setName("RecordID");
		$html .= $RecordID->gethtml();

		$DBTableName = new Hidden();
		$DBTableName->setName("DBTableName");
		$html .= $DBTableName->gethtml();

		$PrimaryField = new Hidden();
		$PrimaryField->setName("PrimaryField");
		$html .= $PrimaryField->gethtml();

		$CallingPage = new Hidden();
		$CallingPage->setName("CallingPage");
		if (isset($_POST['CallingPage']))
			$CallingPage->setValue($_POST['CallingPage']);
		$html .= $CallingPage->gethtml();

		$associateDateTimes = new DateTimeSelectAssociate();
		$associateDateTimes->setStartDateTimeSelect("InsertRecord_Events_Start");
		$associateDateTimes->setEndDateTimeSelect("InsertRecord_Events_End");
		$html .= $associateDateTimes->getHTML();

		if($_POST['RecordID']!='')
			$Panel = new PanelEditDBRecord($this->Database,$_POST['DBTableName'],$_POST['RecordID']);
		else
			$Panel = new PanelEditDBRecord($this->Database,$_POST['DBTableName'],-1);
		$Panel->setParentPage($this);
		$html .= $Panel->getHTML();

		$html .= $this->getBodyBottomHTML();
		return $html;
	}
}
?>